@extends('layout.default')

@section('layout.content')

<div class="row">
  <div class="col-xs-3">
    
    <div class="profile-user-info">
      <div class="profile-info-row">
        <div class="profile-info-name"></div>
        <div class="profile-info-value">
          <h4><span><b>{{$user->name}}</b></span></h4>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 账号：</div>
        <div class="profile-info-value">
          <span><b>{{$user->account}}</b></span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 证件号码：</div>
        <div class="profile-info-value">
          <span>{{$user->idcard}}</span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 联系电话：</div>
        <div class="profile-info-value">
          <span>{{$user->mobile}}</span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> {{$user->type == 1?'就读学校：':'所属单位：'}}</div>
        <div class="profile-info-value">
          <span>{{ $user->school->name }}</span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 所属分支：</div>
        <div class="profile-info-value">
          <span>{{ $user->branch->name }}</span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 登记时间：</div>
        <div class="profile-info-value">
          <span>{{ date('Y-m-d H:i',$user->created_at) }}</span>
        </div>
      </div>
      <div class="profile-info-row">
        <div class="profile-info-name"> 备注：</div>
        <div class="profile-info-value">
          <span>{{ $user->memo }}</span>
        </div>
      </div>
    </div>

  </div>

  <div class="col-xs-9">
    <div class="space-12"></div>
    <div class="tabbable tabs-left">
        <ul class="nav nav-tabs" id="myTab">          
          <li class="active">
            <a data-toggle="tab" href="#sign" id="tab_sign">
              签到
              <span class="badge badge-pink">{{$user->summary->signs}}</span>
            </a>
          </li>
          <li class="">
            <a data-toggle="tab" href="#borrow">
              借阅
              <span class="badge badge-info">{{$user->summary->borrows}}</span>
            </a>
          </li>
          <li class="">
            <a data-toggle="tab" href="#return">
              还书
              <span class="badge badge-success">{{$user->summary->returns}}</span>
            </a>
          </li>
          <li class="">
            <a data-toggle="tab" href="#plan">
              培训
              <span class="badge badge-danger">{{$user->enrols->count()}}</span>
            </a>
          </li>
          <li class="">
            <a data-toggle="tab" href="#point">
              积分
              <span class="badge badge-yellow">{{$user->summary->points}}</span>
            </a>
          </li>

        </ul>
        <div class="tab-content">          
          <div id="sign" class="tab-pane active fade in">
            
              
                <table class="table table-hover table-striped table-bordered">
                  <thead>
                  <tr>
                    <th class="align-middle" style="width: 240px !important;">活动名称</th>
                    <th class="align-middle">活动日期</th>
                    <th class="center">签到时间</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach($user->tracks as $sign)
                    <tr>
                      <td class="align-middle">{!! $sign->activity->present()->showtitle !!}</td>
                      <td class="align-middle smaller-80">{!! $sign->activity->present()->showtime !!}</td>
                      <td class="center smaller-80">{{ date('Y-m-d H:i',$sign->date) }}</td>
                    </tr>
                  @endforeach
                  </tbody>
                </table>
              
          </div>
          <div id="borrow" class="tab-pane fade">
           
                <table class="table table-hover table-striped table-bordered nonborder">
                  <thead>
                  <tr>
                    <th class="center">封面</th>
                    <th class="center">ISBN</th>
                    <th class="align-middle">书名</th>
                    <th class="center" style="width:100px;">借阅日期</th>
                    <th style="width:70px;" class="center hidden-480">书架号</th>
                    <th style="width:60px;" class="center hidden-480">状态</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach($user->borrows as $borrow)
                    <tr>
                      <td class="center"><a href="{{route('book.borrows',array('id'=>$borrow->book->id) )}}"><img class="lazy book-img img-error1" src="/assets/images/blank.gif" data-original="/assets/images/books/{{$borrow->book->dbid}}.jpg" /></a></td>
                      <td class="center smaller-80"><a
                            href="{{ route('book.edit',array('id'=>$borrow->book->id) ) }}">{{ $borrow->book->isbn }}</a>
                      </td>
                      <td class="align-middle">{{ $borrow->book->title }}</td>
                      <td class="center smaller-80">{{date('Y-m-d',$borrow->date_begin)}}</td>
                      <td class="center smaller-80">{!! $borrow->book->present()->bookStore !!}</td>
                      <td class="center hidden-480">{!! $borrow->present()->BorrowStatus !!}</td>
                    </tr>
                  @endforeach
                  </tbody>
                </table>
              
          </div>
          <div id="return" class="tab-pane fade">
            
                <table class="table table-hover table-striped table-bordered nonborder">
                  <thead>
                  <tr>
                    <th class="center">封面</th>
                    <th class="center">ISBN</th>
                    <th class="align-middle">书名</th>
                    <th class="center" style="width:100px;">归还日期</th>
                    <th style="width:70px;" class="center hidden-480">书架号</th>
                    <th style="width:60px;" class="center hidden-480">状态</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach($user->returns as $return)
                    <tr>
                      <td class="center"><a href="{{route('book.borrows',array('id'=>$return->book->id) )}}"><img class="lazy book-img img-error1" src="/assets/images/blank.gif" data-original="/assets/images/books/{{$return->book->dbid}}.jpg" /></a></td>
                      <td class="center smaller-80"><a
                            href="{{ route('book.edit',array('id'=>$return->book->id) ) }}">{{ $return->book->isbn }}</a>
                      </td>
                      <td class="align-middle">{{ $return->book->title }}</td>
                      <td class="center smaller-80">{{date('Y-m-d',$return->date_return)}}</td>
                      <td class="center smaller-80">{!! $return->book->present()->bookStore !!}</td>
                      <td class="center">{!! $return->present()->BorrowStatus !!}</td>

                    </tr>
                  @endforeach
                  </tbody>
                </table>
              
          </div>

          <div id="plan" class="tab-pane fade">
            
                <table class="table table-hover table-striped table-bordered">
                  <thead>
                  <tr>
                    <th class="align-middle">类型</th>
                    <th class="align-middle">名称</th>
                    <th class="align-middle">班级</th>
                    <th class="center">报名时间</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach($user->enrols as $enrol)
                    <tr>                      
                      <td class="align-middle">{{ $enrol->category->name }}</td>
                      <td class="align-middle">{{ $enrol->plan->name }}</td>
                      <td class="align-middle">{{ $enrol->grade->name }}</td>
                      <td class="center smaller-80">{{$enrol->created_at}}</td>
                    </tr>
                  @endforeach
                  </tbody>
                </table>
              
          </div>


          <div id="point" class="tab-pane fade">
            
                <table class="table table-hover table-striped table-bordered">
                  <thead>
                  <tr>
                    <th class="align-middle" style="width: 240px !important;">活动主题</th>
                    <th class="center">积分类型</th>
                    <th class="center">积分值</th>
                    <th class="center">日期</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach($user->records as $point)
                    <tr>
                      <td class="align-middle">{!! $point->activity->present()->showtitle !!}</td>
                      <td class="center smaller-80">{!! $point->present()->showtype !!}</td>
                      <td class="center"><b>{!! $point->present()->showamount !!}</b></td>
                      <td class="center smaller-80">{{ date('Y-m-d H:i',$point->date) }}</td>
                    </tr>
                  @endforeach
                  </tbody>
                </table>
              
          </div>

        </div>
      </div>
    </div>

  </div>
</div>


@stop

@section('javascript')
<script src="//cdn.bootcss.com/jquery_lazyload/1.9.7/jquery.lazyload.min.js"></script>
  <script type="text/javascript">

      $(function () {

           $(".lazy").lazyload({
              effect : "fadeIn"
            });
  

      });
  </script>
@stop